#include "stdafx.h"
#include "Headers.h"
#include "LocalDataFun.h"
#include "GameFunctions.h"

void Mode()
{
	SetMode(640,480,32);
	_IsWindowed = true;
}

void SetDataPath()
{
	ArtAssetsPath = "";
	RTDPath = "";
};

void BuildLogic()
{
	FArray = NewVoidPointers(8);
	FArray[FN_GAMEPLAY] = (void*)Gameplay;
	FArray[FN_PLAYERFUNC] = (void*)PlayerFunc;
	FArray[FN_TITLESCREEN] = (void*)TitleScreen;
	FArray[FN_ENEMYFUNC] = (void*)EnemyFunc;
	FArray[FN_UPDATEOBJMAP] = (void*)UpdateObjMap;
	FArray[FN_UPDATEDELTATIME] = (void*)UpdateDeltaTime;
	FArray[FN_AICONTROLLER] = (void*)AIController;
	FArray[FN_MOUSECONTROLLER] = (void*)MouseController;

	maxFIndex = 7;

	TMArray = NewTimers(1);
	TMArray[TIMER_GAMEPLAY] = Timer(GetTimerFunction(FN_GAMEPLAY),1,TU_GameLoops,true,TM_Once);

	maxTMIndex = 0;

	NArray = NewNodePointers(2);
	static ObjData ld_objdata;
	NArray[LD_OBJDATA] = (ObjData*)&ld_objdata;
	static DeltaData ld_deltadata;
	NArray[LD_DELTADATA] = (DeltaData*)&ld_deltadata;
	maxNIndex = 1;

};

void OnGameStart()
{
};

void OnGameEnd(){
};

void OnSave(File& file)
{
	file.Write(deltaTime);
	file.Write(prevTime);
	
};

void OnLoad(File& file)
{
	file.Read(deltaTime);
	file.Read(prevTime);
	
};

void Fun()
{
	myGame->behavior.AddFunction(FN_UPDATEDELTATIME);
	myGame->AddLocalVariable(LD_DELTADATA);
	GameNode *g1;
	g1=NewGameNode();
	g1->Id(1);
	g1->Name("TITLE");
	g1->gameNodeActorsFunction = LoadAnimation_TITLE;
	g1->gameNodeLevelFunction = Init_TITLEFunction;
	g1->transitionFunction = Exit_TITLEFunction;
	g1->endLevelFunction = End_TITLEFunction;
	myGame->Add(g1);

	GameNode *g2;
	g2=NewGameNode();
	g2->Id(2);
	g2->Name("LOADOUT_SCREEN");
	g2->gameNodeActorsFunction = LoadAnimation_LOADOUT_SCREEN;
	g2->gameNodeLevelFunction = Init_LOADOUT_SCREENFunction;
	g2->transitionFunction = Exit_LOADOUT_SCREENFunction;
	g2->endLevelFunction = End_LOADOUT_SCREENFunction;
	myGame->Add(g2);

	GameNode *g3;
	g3=NewGameNode();
	g3->Id(3);
	g3->Name("GAMEPLAY");
	g3->gameNodeActorsFunction = LoadAnimation_GAMEPLAY;
	g3->gameNodeLevelFunction = Init_GAMEPLAYFunction;
	g3->transitionFunction = Exit_GAMEPLAYFunction;
	g3->endLevelFunction = End_GAMEPLAYFunction;
	myGame->Add(g3);

	GameNode *g4;
	g4=NewGameNode();
	g4->Id(4);
	g4->Name("SPEC_TREE");
	g4->gameNodeActorsFunction = LoadAnimation_SPEC_TREE;
	g4->gameNodeLevelFunction = Init_SPEC_TREEFunction;
	g4->transitionFunction = Exit_SPEC_TREEFunction;
	g4->endLevelFunction = End_SPEC_TREEFunction;
	myGame->Add(g4);


	myGame->Title("digipen-contest-game");
}
